﻿package frEngine.shader.filters.fragmentFilters
{
    import __AS3__.vec.*;
    import frEngine.shader.*;
    import frEngine.shader.filters.*;

    public class BlightFilter extends FilterBase
    {
        public var blightValue:Vector.<Number>;

        public function BlightFilter()
        {
            this.blightValue = new Vector.<Number>(4, true);
            super(FilterType.BlightFilter, FilterPriority.BlightFilter);
            return;
        }// end function

        override public function setRegisterParams(param1:Program3dRegisterInstance) : void
        {
            param1.getParamByName("{blightValue}", false).value = this.blightValue;
            return;
        }// end function

        override public function get programeId() : String
        {
            return "BlightFilter0";
        }// end function

        override public function clone() : FilterBase
        {
            return this;
        }// end function

        public function set blightness(param1:Number) : void
        {
            this.blightValue[0] = 2 * param1;
            this.blightValue[1] = 2 * param1 - 1;
            this.blightValue[2] = param1 <= 0.5 ? (1) : (0);
            this.blightValue[3] = 1 - this.blightValue[2];
            return;
        }// end function

        override public function createFragmentColor(param1:Program3dRegisterInstance, param2:Boolean) : String
        {
            var _loc_3:String = "";
            var _loc_4:* = new Array();
            _loc_4.push(new ToBuilderInfo("fc1", "{blightValue}", false, 1, this.blightValue));
            _loc_3 = _loc_3 + "mul           ft1.xyz       \t  \t{output}.xyz  \t\t  \t\tfc1.x\t\t\t\t\t\t\n";
            _loc_3 = _loc_3 + "mul           ft1.xyz       \t  \tft1.xyz  \t\t  \t\t\tfc1.z\t\t\t\t\t\t\n";
            _loc_3 = _loc_3 + "sub           ft2.xyz       \t  \t{fcConst1}.zzz\t\t\t\t{output}.xyz  \t\t  \t\t\n";
            _loc_3 = _loc_3 + "mul           ft2.xyz       \t  \tft2.xyz\t\t\t\t\t\tfc1.y\t\t  \t\t  \t\t\n";
            _loc_3 = _loc_3 + "add           ft2.xyz       \t  \tft2.xyz\t\t\t\t\t\t{output}.xyz\t\t  \t\t\n";
            _loc_3 = _loc_3 + "mul           ft2.xyz       \t  \tft2.xyz  \t\t  \t\t\tfc1.w\t\t\t\t\t\t\n";
            _loc_3 = _loc_3 + "add           {output}.xyz       \tft2.xyz\t\t\t\t\t\tft1.xyz\t\t  \t\t\t\t\n";
            _loc_3 = _loc_3 + "mul           {output}.xyz       \t{output}.xyz\t\t\t\t{output}.w\t  \t\t\t\t\n";
            _loc_3 = param1.toBuild(_loc_3, _loc_4);
            return _loc_3;
        }// end function

    }
}
